<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="css/aui.css">
    <script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>
    <script type="text/javascript" src="js/init.js"></script>
    <title>我的团队</title>
    <style>
        .shadow{
            box-shadow: 0 3px 10px #e2e2e2;
        }
        .line-l:before{
            content: '';
            position: absolute;
            width: .05rem;
            height: 100%;
            background: #3668c8;
            left:0;
        }
    </style>
</head>
<body>
<header>
    <a href="index.html" class="f1 head-back"></a>
    <div id="teamname" class="f8">我的团队</div>
    <div class="f1"></div>
</header>
<section class="bg-gray">

    <div class="pad-2">

        <div class="bg-white border-radius-1 pad-3 flex mar-b-3 shadow ">
            <p class="f1 pad-l-2 line-l re ">直接邀请好友</p>
            <div>
                <p id="mynum" class="color-orange right pad-b-1">0人</p>
                <p class="font25">团队总业绩 <span id="myyeji"></span></p>
            </div>
        </div>

        <ul id="xjinfo" class="bg-white border-radius-1 mar-b-3 shadow">
            <!--<li class="pad-2-3 border-b-gray">
                <p class="pad-b-1 flex">
                    <span class="f1"></span>
                    <span>人</span>
                </p>
                <p class="color-gray font25 flex">
                    <span class="f1"></span>
                    <span>业绩</span>
                </p>
            </li>-->
        </ul>

        <div class="bg-white pad-2-3 center">到底了</div>

    </div>

</section>

<script src="js/foot.js"></script>
<script>

    loadteam(localStorage.user_id);

    function loadteam(id) {
        var data = {
            userid: localStorage.user_id,
            token: localStorage.token,
            check_id: id,
        };
        new AjaxRequest({
            type: 'post',
            data: data,
            dataType: 'json',
            url: hostUrl + 'index/Team/teamlist',
            isShowLoader: true,
            callback: res => {

                if(res.status == 1){

                    $("#mynum").text(res.data.userifo.num+'人');
                    $("#myyeji").text(res.data.userifo.money);
                    var info = res.data.xjinfo;
                    var item = '';
                    for (var i=0;i<info.length;i++){
                        item += '<li class="block pad-2-3 border-b-gray" data-id="'+info[i].id+'" data-account="'+info[i].account+'"><p class="pad-b-1 flex"><span class="f1">'+info[i].account+'</span><span>'+(info[i].num?info[i].num:0)+'人</span></p><p class="color-gray font25 flex"><span class="f1">'+info[i].creattime+'</span><span>业绩'+(info[i].money?info[i].money:0)+'</span></p></li>';
                    }
                    $("#xjinfo").html(item);

                }

            }
        });
    }
    $(document).on('click','#xjinfo li',function () {

        var index = $(this).attr('data-id');

        var account = $(this).attr('data-account');

        loadteam(index);

        $("#teamname").text(account);

    });


</script>

</body>
</html>